﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SiteMaster.Master" AutoEventWireup="true"
    CodeBehind="ExportMaterial.aspx.cs" Inherits="KCL.Material.ExportMaterial" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../styles/css/style.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtDate"
                Format="dd/MM/yyyy" PopupButtonID="imgbtnDate">
            </asp:CalendarExtender>
            <asp:SqlDataSource ID="srcMaterial" runat="server" ConnectionString="<%$ ConnectionStrings:KCLConnectionString %>"
                SelectCommand="SELECT Material.code + ' - [' + Material.name + '] - [' + Color.name + '] - [' + Thickness.thick + ']' display, Material.code code
FROM Material, Color, Thickness
WHERE Material.isActive  = 1
	AND Material.colorId = Color.id
	AND Material.thicknessId = Thickness.id"></asp:SqlDataSource>
            <div class="boxed">
                <h2 class="title" style="text-align: left; font-weight: bold; padding-left: 20px;
                    padding-top: 10px; height: 30px">
                    Xuất nguyên liệu
                </h2>
                <table style="width: 955px;" cellpadding="5px">
                    <tr>
                        <td>
                            Mã nguyên liệu
                        </td>
                        <td>
                            <asp:ComboBox ID="cboMaterial" runat="server" Width="200px" DataSourceID="srcMaterial"
                                DataTextField="display" DataValueField="code" MaxLength="0" Style="display: inline;"
                                AutoCompleteMode="SuggestAppend" DropDownStyle="DropDownList">
                            </asp:ComboBox>
                        </td>
                        <td>
                            Nơi nhận
                        </td>
                        <td>
                            <asp:TextBox ID="txtReceivePlace" runat="server" Width="200px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Số lượng
                        </td>
                        <td>
                            <asp:TextBox ID="txtQuantity" runat="server" Width="200px"></asp:TextBox>
                        </td>
                        <td>
                            Người nhận
                        </td>
                        <td>
                            <asp:TextBox ID="txtReceiver" runat="server" Width="200px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Người xuất
                        </td>
                        <td>
                            <asp:TextBox ID="txtExporter" runat="server" Width="200px"></asp:TextBox>
                        </td>
                        <td rowspan="3" valign="top">
                            Ghi chú
                        </td>
                        <td rowspan="3">
                            <asp:TextBox ID="txtNote" runat="server" Height="90px" TextMode="MultiLine" Width="400px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Ngày xuất
                        </td>
                        <td>
                            <asp:TextBox ID="txtDate" runat="server" Width="200px"></asp:TextBox>
                            <asp:ImageButton ID="imgbtnDate" runat="server" ImageUrl="~/styles/images/calendar_icon.gif" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td rowspan="2" valign="top">
                            &nbsp;
                            <asp:Button ID="btnAddMExp" runat="server" Height="30px" OnClick="btnAddMExp_Click"
                                Text="Xuất nguyên liệu" Width="130px" />
                            &nbsp;<asp:Button ID="btnUpdateMExp" runat="server" Height="30px" OnClick="btnUpdateMExp_Click"
                                Text="Chỉnh Sửa" Width="130px" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            <asp:Label ID="lblMsgMaterialExport" runat="server" Font-Italic="True"></asp:Label>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="boxed">
                <h2 class="title" style="text-align: left; font-weight: bold; padding-left: 20px;
                    padding-top: 10px; height: 30px">
                    Danh sách xuất nguyên liệu
                </h2>
                <asp:GridView ID="dgvMaterialExp" runat="server" BackColor="White" BorderColor="#DEDFDE"
                BorderStyle="None" BorderWidth="1px" CellPadding="4" EnableModelValidation="True"
                ForeColor="Black" GridLines="Vertical" Width="950px" AllowPaging="True" AutoGenerateColumns="False"
                DataKeyNames="id" DataSourceID="srcMaterialExp" PageSize="20" 
                    OnSelectedIndexChanged="dgvMaterialExp_SelectedIndexChanged">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:CommandField SelectText="Chọn" ShowSelectButton="True" />
                    <asp:BoundField DataField="materialCode" HeaderText="Mã nguyên liệu" SortExpression="materialCode" />
                    <asp:BoundField DataField="quantity" HeaderText="Số lượng" SortExpression="quantity">
                        <ItemStyle HorizontalAlign="Right" />
                    </asp:BoundField>
                    <asp:BoundField DataField="receivePlace" HeaderText="Nơi nhận" SortExpression="receivePlace" />
                    <asp:BoundField DataField="receiver" HeaderText="Người nhận" SortExpression="receiver" />
                    <asp:BoundField DataField="exporter" HeaderText="Người xuất" SortExpression="exporter" />
                    <asp:BoundField DataField="date" DataFormatString="{0:dd/MM/yyyy}" HeaderText="Ngày xuất"
                        SortExpression="date" />
                    <asp:BoundField DataField="note" HeaderText="Ghi chú" SortExpression="note" />
                    <asp:TemplateField ShowHeader="False">
                        <ItemTemplate>
                            <asp:LinkButton Style="color: Black" ID="LinkButton1" runat="server" CausesValidation="False"
                                CommandName="Delete" Text="Xóa" OnClientClick="javascript:return confirm('Bạn có chắc muốn xóa dòng này?');"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <FooterStyle BackColor="#CCCC99" />
                <HeaderStyle BackColor="#FFFFCC" Font-Bold="True" ForeColor="#CC0000" />
                <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                <RowStyle BackColor="#F7F7DE" />
                <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
            </asp:GridView>
            </div>
            <asp:ObjectDataSource ID="srcMaterialExp" runat="server" DataObjectTypeName="KCL.Code.MaterialExport"
                DeleteMethod="Delete" SelectMethod="GetAllMaterialExports" TypeName="KCL.Code.Business.MaterialExportServices">
            </asp:ObjectDataSource>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
